package fr.aion.model.objects;

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.SimpleTimeZone;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "account")
public class Account {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "account_id")
	private Integer id;

	@Column(name = "account_login", nullable = false, unique = true)
	private String login;

	@Column(name = "account_password")
	private String password;

	@Column(name = "account_registrationDate")
	@Temporal(TemporalType.DATE)
	private Calendar registrationDate;

	@Column(name = "account_activated")
	private boolean activated;

	@Column(name = "account_mail")
	private String mail;

	@OneToMany(mappedBy = "account")
	private List<Character> characterList;

	
	public Account() {
		// TODO Auto-generated constructor stub
	}
	
	
	
	
	public Account(String login, String password, boolean activated, String mail) {
		super();
		this.login = login;
		this.password = password;
		this.activated = activated;
		this.mail = mail;
		this.registrationDate = new GregorianCalendar(new SimpleTimeZone(3600000, "Europe/Paris",
				Calendar.MARCH, -1, Calendar.SUNDAY, 3600000, SimpleTimeZone.UTC_TIME,
				Calendar.OCTOBER, -1, Calendar.SUNDAY, 3600000, SimpleTimeZone.UTC_TIME,
				3600000));
	}




	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Calendar getRegistrationDate() {
		return registrationDate;
	}

	public void setRegistrationDate(Calendar registrationDate) {
		this.registrationDate = registrationDate;
	}

	public boolean isActivated() {
		return activated;
	}

	public void setActivated(boolean activated) {
		this.activated = activated;
	}

	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	public List<Character> getCharacterList() {
		return characterList;
	}

	public void setCharacterList(List<Character> characterList) {
		this.characterList = characterList;
	}
	
	
	
}
